package com.dinggao.crossgo.module.roadbook.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dinggao.crossgo.R;
import com.dinggao.crossgo.core.manage.ApiManager;
import com.dinggao.crossgo.module.roadbook.data.ParentDetailsBean;

import java.util.List;

/**
 * created by mapingan on 2018/8/23.
 */
public class ParentDetailsAdapter extends BaseQuickAdapter<ParentDetailsBean.DataBean.RoadBookJournalListBean.ItemsBean,BaseViewHolder> {


    public ParentDetailsAdapter(int layoutResId, @Nullable List<ParentDetailsBean.DataBean.RoadBookJournalListBean.ItemsBean> data) {

        super(R.layout.item_parent_detail_recycler, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ParentDetailsBean.DataBean.RoadBookJournalListBean.ItemsBean item) {

        helper.setText(R.id.road_book_sub_create_time,item.getTime())
                .setText(R.id.road_book_sub_position_tv,item.getLocation())
                .setText(R.id.road_book_sub_content,item.getContent());
       // String url="https://home.sddgxx.com"+item.getRoadBookJournalList().get(0).getAttachments().get(0).getAttachmentPath();
        String url="https://home.sddgxx.com/img/pic/roadBook/defaultRoadBook.jpg";
       // LogUtils.e("url",url);

        if (item.getAttachments().size()>0){
            Glide.with(mContext).load(ApiManager.IMAG_URL+item.getAttachments().get(0).getAttachmentPath()).into((ImageView) helper.getView(R.id.parent_detail_image));
        }
    }
}
